<template>

    <div class="container" style="">

        <el-row :gutter="20">

            <el-col :span="4"   v-for="item in items"  :key="item.id">
                <div style="">
                    <vmCard2 :editable="true" :title="item.title"
                            :photoId="item.id"
                            :proId="item.proId"
                            :img="item.img"
                            :desc="item.desc"
                            :detailUrl="item.detailUrl"
                            :editUrl="item.editUrl"
                            @delete-ok=" deleteOk(item) " ></vmCard2>
                </div>
            </el-col>

        </el-row>

    </div>

</template>

<script>
    import * as appServer from '../../store/appServerParams.js'
    import * as util from '../../assets/util.js';

    import vmCard2 from "./vm-card2";

    export default {
        components: { vmCard2 },

        data() {
            return {
                items: [

                ] ,
            }
        },
        methods: {
            deleteOk(   ){
                let vm = this;
                console.log(" delete ok ");
                vm.getFeatures();
            },

            getFeatures(){
                let vm = this;
                let path = "/photo/getFeatures";
                vm.$http.post( path ,{  }
                ).then(function (response) {
                    if( response.data.result ){
                        let imgs = response.data.arr;
                        let tmpArr = [];
                        for (let imgIndex in imgs) {
                            let tmpServerImg = imgs[imgIndex];
                            let tmpImg = {};
                            tmpImg.title = "";
                            tmpImg.desc = tmpServerImg.featureDesc;
                            tmpImg.detailUrl = appServer.BASE_URL + tmpServerImg.photoPath;
                            tmpImg.img = appServer.BASE_URL + tmpServerImg.photoPath2;
                            tmpImg.editUrl = appServer.BASE_URL + tmpServerImg.photoPath2;
                            tmpImg.id = tmpServerImg.fId;
                            tmpImg.proId = tmpServerImg.proId;

                            tmpArr.push(tmpImg);
                        }
                        vm.items = tmpArr;
                    }
                }).catch(function (error) {
                    console.log(error)
                    vm.$message.error("error");
                })
            },
        },
        created: function () {
            var vm = this;
            vm.getFeatures();
        }
    }
</script>

